
_grep:     file format elf32-i386


Disassembly of section .text:

00000000 <main>:
  }
}

int
main(int argc, char *argv[])
{
   0:	55                   	push   %ebp
   1:	89 e5                	mov    %esp,%ebp
   3:	57                   	push   %edi
   4:	56                   	push   %esi
   5:	53                   	push   %ebx
   6:	83 e4 f0             	and    $0xfffffff0,%esp
   9:	83 ec 20             	sub    $0x20,%esp
   c:	8b 7d 08             	mov    0x8(%ebp),%edi
   f:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  int fd, i;
  char *pattern;
  
  if(argc <= 1){
  12:	83 ff 01             	cmp    $0x1,%edi
  15:	0f 8e 8e 00 00 00    	jle    a9 <main+0xa9>
    printf(2, "usage: grep pattern [file ...]\n");
    exit();
  }
  pattern = argv[1];
  1b:	8b 53 04             	mov    0x4(%ebx),%edx
    }
  }
}

int
main(int argc, char *argv[])
  1e:	83 c3 08             	add    $0x8,%ebx
    printf(2, "usage: grep pattern [file ...]\n");
    exit();
  }
  pattern = argv[1];
  
  if(argc <= 2){
  21:	83 ff 02             	cmp    $0x2,%edi
    }
  }
}

int
main(int argc, char *argv[])
  24:	be 02 00 00 00       	mov    $0x2,%esi
  
  if(argc <= 1){
    printf(2, "usage: grep pattern [file ...]\n");
    exit();
  }
  pattern = argv[1];
  29:	89 54 24 1c          	mov    %edx,0x1c(%esp)
  
  if(argc <= 2){
  2d:	74 65                	je     94 <main+0x94>
  2f:	90                   	nop
    grep(pattern, 0);
    exit();
  }

  for(i = 2; i < argc; i++){
    if((fd = open(argv[i], 0)) < 0){
  30:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  37:	00 
  38:	8b 03                	mov    (%ebx),%eax
  3a:	89 04 24             	mov    %eax,(%esp)
  3d:	e8 82 05 00 00       	call   5c4 <open>
  42:	85 c0                	test   %eax,%eax
  44:	78 2f                	js     75 <main+0x75>
      printf(1, "grep: cannot open %s\n", argv[i]);
      exit();
    }
    grep(pattern, fd);
  46:	8b 54 24 1c          	mov    0x1c(%esp),%edx
  if(argc <= 2){
    grep(pattern, 0);
    exit();
  }

  for(i = 2; i < argc; i++){
  4a:	83 c6 01             	add    $0x1,%esi
  4d:	83 c3 04             	add    $0x4,%ebx
    if((fd = open(argv[i], 0)) < 0){
      printf(1, "grep: cannot open %s\n", argv[i]);
      exit();
    }
    grep(pattern, fd);
  50:	89 44 24 04          	mov    %eax,0x4(%esp)
  54:	89 44 24 18          	mov    %eax,0x18(%esp)
  58:	89 14 24             	mov    %edx,(%esp)
  5b:	e8 d0 01 00 00       	call   230 <grep>
    close(fd);
  60:	8b 44 24 18          	mov    0x18(%esp),%eax
  64:	89 04 24             	mov    %eax,(%esp)
  67:	e8 40 05 00 00       	call   5ac <close>
  if(argc <= 2){
    grep(pattern, 0);
    exit();
  }

  for(i = 2; i < argc; i++){
  6c:	39 f7                	cmp    %esi,%edi
  6e:	7f c0                	jg     30 <main+0x30>
      exit();
    }
    grep(pattern, fd);
    close(fd);
  }
  exit();
  70:	e8 0f 05 00 00       	call   584 <exit>
    exit();
  }

  for(i = 2; i < argc; i++){
    if((fd = open(argv[i], 0)) < 0){
      printf(1, "grep: cannot open %s\n", argv[i]);
  75:	8b 03                	mov    (%ebx),%eax
  77:	c7 44 24 04 b8 09 00 	movl   $0x9b8,0x4(%esp)
  7e:	00 
  7f:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  86:	89 44 24 08          	mov    %eax,0x8(%esp)
  8a:	e8 41 06 00 00       	call   6d0 <printf>
      exit();
  8f:	e8 f0 04 00 00       	call   584 <exit>
    exit();
  }
  pattern = argv[1];
  
  if(argc <= 2){
    grep(pattern, 0);
  94:	89 14 24             	mov    %edx,(%esp)
  97:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  9e:	00 
  9f:	e8 8c 01 00 00       	call   230 <grep>
    exit();
  a4:	e8 db 04 00 00       	call   584 <exit>
{
  int fd, i;
  char *pattern;
  
  if(argc <= 1){
    printf(2, "usage: grep pattern [file ...]\n");
  a9:	c7 44 24 04 98 09 00 	movl   $0x998,0x4(%esp)
  b0:	00 
  b1:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
  b8:	e8 13 06 00 00       	call   6d0 <printf>
    exit();
  bd:	e8 c2 04 00 00       	call   584 <exit>
  c2:	90                   	nop
  c3:	90                   	nop
  c4:	90                   	nop
  c5:	90                   	nop
  c6:	90                   	nop
  c7:	90                   	nop
  c8:	90                   	nop
  c9:	90                   	nop
  ca:	90                   	nop
  cb:	90                   	nop
  cc:	90                   	nop
  cd:	90                   	nop
  ce:	90                   	nop
  cf:	90                   	nop

000000d0 <matchstar>:
  return 0;
}

// matchstar: search for c*re at beginning of text
int matchstar(int c, char *re, char *text)
{
  d0:	57                   	push   %edi
  d1:	56                   	push   %esi
  d2:	53                   	push   %ebx
  d3:	83 ec 10             	sub    $0x10,%esp
  d6:	8b 74 24 20          	mov    0x20(%esp),%esi
  da:	8b 7c 24 24          	mov    0x24(%esp),%edi
  de:	8b 5c 24 28          	mov    0x28(%esp),%ebx
  e2:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  do{  // a * matches zero or more instances
    if(matchhere(re, text))
  e8:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  ec:	89 3c 24             	mov    %edi,(%esp)
  ef:	e8 3c 00 00 00       	call   130 <matchhere>
  f4:	85 c0                	test   %eax,%eax
  f6:	75 20                	jne    118 <matchstar+0x48>
      return 1;
  }while(*text!='\0' && (*text++==c || c=='.'));
  f8:	0f b6 03             	movzbl (%ebx),%eax
  fb:	84 c0                	test   %al,%al
  fd:	74 0f                	je     10e <matchstar+0x3e>
  ff:	0f be c0             	movsbl %al,%eax
 102:	83 c3 01             	add    $0x1,%ebx
 105:	39 f0                	cmp    %esi,%eax
 107:	74 df                	je     e8 <matchstar+0x18>
 109:	83 fe 2e             	cmp    $0x2e,%esi
 10c:	74 da                	je     e8 <matchstar+0x18>
  return 0;
}
 10e:	83 c4 10             	add    $0x10,%esp
{
  do{  // a * matches zero or more instances
    if(matchhere(re, text))
      return 1;
  }while(*text!='\0' && (*text++==c || c=='.'));
  return 0;
 111:	31 c0                	xor    %eax,%eax
}
 113:	5b                   	pop    %ebx
 114:	5e                   	pop    %esi
 115:	5f                   	pop    %edi
 116:	c3                   	ret    
 117:	90                   	nop
 118:	83 c4 10             	add    $0x10,%esp
// matchstar: search for c*re at beginning of text
int matchstar(int c, char *re, char *text)
{
  do{  // a * matches zero or more instances
    if(matchhere(re, text))
      return 1;
 11b:	b8 01 00 00 00       	mov    $0x1,%eax
  }while(*text!='\0' && (*text++==c || c=='.'));
  return 0;
}
 120:	5b                   	pop    %ebx
 121:	5e                   	pop    %esi
 122:	5f                   	pop    %edi
 123:	c3                   	ret    
 124:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 12a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00000130 <matchhere>:
  return 0;
}

// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
 130:	53                   	push   %ebx
 131:	83 ec 18             	sub    $0x18,%esp
 134:	8b 54 24 20          	mov    0x20(%esp),%edx
 138:	8b 4c 24 24          	mov    0x24(%esp),%ecx
  if(re[0] == '\0')
 13c:	0f b6 02             	movzbl (%edx),%eax
 13f:	84 c0                	test   %al,%al
 141:	75 22                	jne    165 <matchhere+0x35>
 143:	eb 43                	jmp    188 <matchhere+0x58>
 145:	8d 76 00             	lea    0x0(%esi),%esi
    return 1;
  if(re[1] == '*')
    return matchstar(re[0], re+2, text);
  if(re[0] == '$' && re[1] == '\0')
    return *text == '\0';
  if(*text!='\0' && (re[0]=='.' || re[0]==*text))
 148:	0f b6 19             	movzbl (%ecx),%ebx
 14b:	84 db                	test   %bl,%bl
 14d:	74 31                	je     180 <matchhere+0x50>
 14f:	3c 2e                	cmp    $0x2e,%al
 151:	74 04                	je     157 <matchhere+0x27>
 153:	38 d8                	cmp    %bl,%al
 155:	75 29                	jne    180 <matchhere+0x50>
}

// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
  if(re[0] == '\0')
 157:	0f b6 42 01          	movzbl 0x1(%edx),%eax
 15b:	84 c0                	test   %al,%al
 15d:	74 29                	je     188 <matchhere+0x58>
  if(re[1] == '*')
    return matchstar(re[0], re+2, text);
  if(re[0] == '$' && re[1] == '\0')
    return *text == '\0';
  if(*text!='\0' && (re[0]=='.' || re[0]==*text))
    return matchhere(re+1, text+1);
 15f:	83 c1 01             	add    $0x1,%ecx
 162:	83 c2 01             	add    $0x1,%edx
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
  if(re[0] == '\0')
    return 1;
  if(re[1] == '*')
 165:	0f b6 5a 01          	movzbl 0x1(%edx),%ebx
 169:	80 fb 2a             	cmp    $0x2a,%bl
 16c:	74 2a                	je     198 <matchhere+0x68>
    return matchstar(re[0], re+2, text);
  if(re[0] == '$' && re[1] == '\0')
 16e:	3c 24                	cmp    $0x24,%al
 170:	75 d6                	jne    148 <matchhere+0x18>
 172:	84 db                	test   %bl,%bl
 174:	75 d2                	jne    148 <matchhere+0x18>
    return *text == '\0';
 176:	31 c0                	xor    %eax,%eax
 178:	80 39 00             	cmpb   $0x0,(%ecx)
 17b:	0f 94 c0             	sete   %al
 17e:	eb 02                	jmp    182 <matchhere+0x52>
  if(*text!='\0' && (re[0]=='.' || re[0]==*text))
    return matchhere(re+1, text+1);
  return 0;
 180:	31 c0                	xor    %eax,%eax
}
 182:	83 c4 18             	add    $0x18,%esp
 185:	5b                   	pop    %ebx
 186:	c3                   	ret    
 187:	90                   	nop
 188:	83 c4 18             	add    $0x18,%esp

// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
  if(re[0] == '\0')
    return 1;
 18b:	b8 01 00 00 00       	mov    $0x1,%eax
  if(re[0] == '$' && re[1] == '\0')
    return *text == '\0';
  if(*text!='\0' && (re[0]=='.' || re[0]==*text))
    return matchhere(re+1, text+1);
  return 0;
}
 190:	5b                   	pop    %ebx
 191:	c3                   	ret    
 192:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
int matchhere(char *re, char *text)
{
  if(re[0] == '\0')
    return 1;
  if(re[1] == '*')
    return matchstar(re[0], re+2, text);
 198:	83 c2 02             	add    $0x2,%edx
 19b:	0f be c0             	movsbl %al,%eax
 19e:	89 4c 24 08          	mov    %ecx,0x8(%esp)
 1a2:	89 54 24 04          	mov    %edx,0x4(%esp)
 1a6:	89 04 24             	mov    %eax,(%esp)
 1a9:	e8 22 ff ff ff       	call   d0 <matchstar>
  if(re[0] == '$' && re[1] == '\0')
    return *text == '\0';
  if(*text!='\0' && (re[0]=='.' || re[0]==*text))
    return matchhere(re+1, text+1);
  return 0;
}
 1ae:	83 c4 18             	add    $0x18,%esp
 1b1:	5b                   	pop    %ebx
 1b2:	c3                   	ret    
 1b3:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 1b9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

000001c0 <match>:
int matchhere(char*, char*);
int matchstar(int, char*, char*);

int
match(char *re, char *text)
{
 1c0:	56                   	push   %esi
 1c1:	53                   	push   %ebx
 1c2:	83 ec 14             	sub    $0x14,%esp
 1c5:	8b 74 24 20          	mov    0x20(%esp),%esi
 1c9:	8b 5c 24 24          	mov    0x24(%esp),%ebx
  if(re[0] == '^')
 1cd:	80 3e 5e             	cmpb   $0x5e,(%esi)
 1d0:	74 3e                	je     210 <match+0x50>
 1d2:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    return matchhere(re+1, text);
  do{  // must look at empty string
    if(matchhere(re, text))
 1d8:	89 5c 24 04          	mov    %ebx,0x4(%esp)
 1dc:	89 34 24             	mov    %esi,(%esp)
 1df:	e8 4c ff ff ff       	call   130 <matchhere>
 1e4:	85 c0                	test   %eax,%eax
 1e6:	75 18                	jne    200 <match+0x40>
      return 1;
  }while(*text++ != '\0');
 1e8:	0f b6 03             	movzbl (%ebx),%eax
 1eb:	83 c3 01             	add    $0x1,%ebx
 1ee:	84 c0                	test   %al,%al
 1f0:	75 e6                	jne    1d8 <match+0x18>
  return 0;
}
 1f2:	83 c4 14             	add    $0x14,%esp
    return matchhere(re+1, text);
  do{  // must look at empty string
    if(matchhere(re, text))
      return 1;
  }while(*text++ != '\0');
  return 0;
 1f5:	31 c0                	xor    %eax,%eax
}
 1f7:	5b                   	pop    %ebx
 1f8:	5e                   	pop    %esi
 1f9:	c3                   	ret    
 1fa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 200:	83 c4 14             	add    $0x14,%esp
{
  if(re[0] == '^')
    return matchhere(re+1, text);
  do{  // must look at empty string
    if(matchhere(re, text))
      return 1;
 203:	b8 01 00 00 00       	mov    $0x1,%eax
  }while(*text++ != '\0');
  return 0;
}
 208:	5b                   	pop    %ebx
 209:	5e                   	pop    %esi
 20a:	c3                   	ret    
 20b:	90                   	nop
 20c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

int
match(char *re, char *text)
{
  if(re[0] == '^')
    return matchhere(re+1, text);
 210:	83 c6 01             	add    $0x1,%esi
 213:	89 74 24 20          	mov    %esi,0x20(%esp)
  do{  // must look at empty string
    if(matchhere(re, text))
      return 1;
  }while(*text++ != '\0');
  return 0;
}
 217:	83 c4 14             	add    $0x14,%esp
 21a:	5b                   	pop    %ebx
 21b:	5e                   	pop    %esi

int
match(char *re, char *text)
{
  if(re[0] == '^')
    return matchhere(re+1, text);
 21c:	e9 0f ff ff ff       	jmp    130 <matchhere>
 221:	eb 0d                	jmp    230 <grep>
 223:	90                   	nop
 224:	90                   	nop
 225:	90                   	nop
 226:	90                   	nop
 227:	90                   	nop
 228:	90                   	nop
 229:	90                   	nop
 22a:	90                   	nop
 22b:	90                   	nop
 22c:	90                   	nop
 22d:	90                   	nop
 22e:	90                   	nop
 22f:	90                   	nop

00000230 <grep>:
char buf[1024];
int match(char*, char*);

void
grep(char *pattern, int fd)
{
 230:	55                   	push   %ebp
  int n, m;
  char *p, *q;
  
  m = 0;
 231:	31 ed                	xor    %ebp,%ebp
char buf[1024];
int match(char*, char*);

void
grep(char *pattern, int fd)
{
 233:	57                   	push   %edi
 234:	56                   	push   %esi
 235:	53                   	push   %ebx
 236:	83 ec 2c             	sub    $0x2c,%esp
 239:	8b 7c 24 40          	mov    0x40(%esp),%edi
 23d:	8d 76 00             	lea    0x0(%esi),%esi
  int n, m;
  char *p, *q;
  
  m = 0;
  while((n = read(fd, buf+m, sizeof(buf)-m)) > 0){
 240:	b8 00 04 00 00       	mov    $0x400,%eax
 245:	29 e8                	sub    %ebp,%eax
 247:	89 44 24 08          	mov    %eax,0x8(%esp)
 24b:	8d 85 c0 0d 00 00    	lea    0xdc0(%ebp),%eax
 251:	89 44 24 04          	mov    %eax,0x4(%esp)
 255:	8b 44 24 44          	mov    0x44(%esp),%eax
 259:	89 04 24             	mov    %eax,(%esp)
 25c:	e8 3b 03 00 00       	call   59c <read>
 261:	85 c0                	test   %eax,%eax
 263:	89 44 24 1c          	mov    %eax,0x1c(%esp)
 267:	0f 8e a2 00 00 00    	jle    30f <grep+0xdf>
 26d:	be c0 0d 00 00       	mov    $0xdc0,%esi
 272:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    m += n;
    p = buf;
    while((q = strchr(p, '\n')) != 0){
 278:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
 27f:	00 
 280:	89 34 24             	mov    %esi,(%esp)
 283:	e8 58 01 00 00       	call   3e0 <strchr>
 288:	85 c0                	test   %eax,%eax
 28a:	89 c3                	mov    %eax,%ebx
 28c:	74 42                	je     2d0 <grep+0xa0>
      *q = 0;
 28e:	c6 03 00             	movb   $0x0,(%ebx)
      if(match(pattern, p)){
 291:	89 74 24 04          	mov    %esi,0x4(%esp)
 295:	89 3c 24             	mov    %edi,(%esp)
 298:	e8 23 ff ff ff       	call   1c0 <match>
 29d:	85 c0                	test   %eax,%eax
 29f:	75 07                	jne    2a8 <grep+0x78>
 2a1:	8d 73 01             	lea    0x1(%ebx),%esi
 2a4:	eb d2                	jmp    278 <grep+0x48>
 2a6:	66 90                	xchg   %ax,%ax
        *q = '\n';
 2a8:	c6 03 0a             	movb   $0xa,(%ebx)
        write(1, p, q+1 - p);
 2ab:	83 c3 01             	add    $0x1,%ebx
 2ae:	89 d8                	mov    %ebx,%eax
 2b0:	29 f0                	sub    %esi,%eax
 2b2:	89 74 24 04          	mov    %esi,0x4(%esp)
 2b6:	89 de                	mov    %ebx,%esi
 2b8:	89 44 24 08          	mov    %eax,0x8(%esp)
 2bc:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 2c3:	e8 dc 02 00 00       	call   5a4 <write>
 2c8:	eb ae                	jmp    278 <grep+0x48>
 2ca:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
      }
      p = q+1;
    }
    if(p == buf)
 2d0:	81 fe c0 0d 00 00    	cmp    $0xdc0,%esi
 2d6:	74 30                	je     308 <grep+0xd8>
  int n, m;
  char *p, *q;
  
  m = 0;
  while((n = read(fd, buf+m, sizeof(buf)-m)) > 0){
    m += n;
 2d8:	03 6c 24 1c          	add    0x1c(%esp),%ebp
      }
      p = q+1;
    }
    if(p == buf)
      m = 0;
    if(m > 0){
 2dc:	85 ed                	test   %ebp,%ebp
 2de:	0f 8e 5c ff ff ff    	jle    240 <grep+0x10>
      m -= p - buf;
 2e4:	b8 c0 0d 00 00       	mov    $0xdc0,%eax
 2e9:	29 f0                	sub    %esi,%eax
 2eb:	01 c5                	add    %eax,%ebp
      memmove(buf, p, m);
 2ed:	89 6c 24 08          	mov    %ebp,0x8(%esp)
 2f1:	89 74 24 04          	mov    %esi,0x4(%esp)
 2f5:	c7 04 24 c0 0d 00 00 	movl   $0xdc0,(%esp)
 2fc:	e8 1f 02 00 00       	call   520 <memmove>
 301:	e9 3a ff ff ff       	jmp    240 <grep+0x10>
 306:	66 90                	xchg   %ax,%ax
        write(1, p, q+1 - p);
      }
      p = q+1;
    }
    if(p == buf)
      m = 0;
 308:	31 ed                	xor    %ebp,%ebp
 30a:	e9 31 ff ff ff       	jmp    240 <grep+0x10>
    if(m > 0){
      m -= p - buf;
      memmove(buf, p, m);
    }
  }
}
 30f:	83 c4 2c             	add    $0x2c,%esp
 312:	5b                   	pop    %ebx
 313:	5e                   	pop    %esi
 314:	5f                   	pop    %edi
 315:	5d                   	pop    %ebp
 316:	c3                   	ret    
 317:	90                   	nop
 318:	90                   	nop
 319:	90                   	nop
 31a:	90                   	nop
 31b:	90                   	nop
 31c:	90                   	nop
 31d:	90                   	nop
 31e:	90                   	nop
 31f:	90                   	nop

00000320 <strcpy>:
#include "user.h"
#include "x86.h"

char*
strcpy(char *s, char *t)
{
 320:	53                   	push   %ebx
 321:	8b 44 24 08          	mov    0x8(%esp),%eax
  char *os;

  os = s;
  while((*s++ = *t++) != 0)
 325:	31 d2                	xor    %edx,%edx
#include "user.h"
#include "x86.h"

char*
strcpy(char *s, char *t)
{
 327:	8b 5c 24 0c          	mov    0xc(%esp),%ebx
 32b:	90                   	nop
 32c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  char *os;

  os = s;
  while((*s++ = *t++) != 0)
 330:	0f b6 0c 13          	movzbl (%ebx,%edx,1),%ecx
 334:	88 0c 10             	mov    %cl,(%eax,%edx,1)
 337:	83 c2 01             	add    $0x1,%edx
 33a:	84 c9                	test   %cl,%cl
 33c:	75 f2                	jne    330 <strcpy+0x10>
    ;
  return os;
}
 33e:	5b                   	pop    %ebx
 33f:	c3                   	ret    

00000340 <strcmp>:

int
strcmp(const char *p, const char *q)
{
 340:	56                   	push   %esi
 341:	53                   	push   %ebx
 342:	8b 4c 24 0c          	mov    0xc(%esp),%ecx
 346:	8b 54 24 10          	mov    0x10(%esp),%edx
  while(*p && *p == *q)
 34a:	0f b6 01             	movzbl (%ecx),%eax
 34d:	0f b6 1a             	movzbl (%edx),%ebx
 350:	84 c0                	test   %al,%al
 352:	74 24                	je     378 <strcmp+0x38>
 354:	38 d8                	cmp    %bl,%al
 356:	74 11                	je     369 <strcmp+0x29>
 358:	eb 2e                	jmp    388 <strcmp+0x48>
 35a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 360:	83 c1 01             	add    $0x1,%ecx
 363:	38 d8                	cmp    %bl,%al
 365:	75 21                	jne    388 <strcmp+0x48>
    p++, q++;
 367:	89 f2                	mov    %esi,%edx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
 369:	0f b6 41 01          	movzbl 0x1(%ecx),%eax
    p++, q++;
 36d:	8d 72 01             	lea    0x1(%edx),%esi
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
 370:	0f b6 5a 01          	movzbl 0x1(%edx),%ebx
 374:	84 c0                	test   %al,%al
 376:	75 e8                	jne    360 <strcmp+0x20>
    p++, q++;
  return (uchar)*p - (uchar)*q;
 378:	0f b6 db             	movzbl %bl,%ebx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
 37b:	31 c0                	xor    %eax,%eax
    p++, q++;
  return (uchar)*p - (uchar)*q;
 37d:	29 d8                	sub    %ebx,%eax
}
 37f:	5b                   	pop    %ebx
 380:	5e                   	pop    %esi
 381:	c3                   	ret    
 382:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
    p++, q++;
  return (uchar)*p - (uchar)*q;
 388:	0f b6 db             	movzbl %bl,%ebx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
 38b:	0f b6 c0             	movzbl %al,%eax
    p++, q++;
  return (uchar)*p - (uchar)*q;
 38e:	29 d8                	sub    %ebx,%eax
}
 390:	5b                   	pop    %ebx
 391:	5e                   	pop    %esi
 392:	c3                   	ret    
 393:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 399:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

000003a0 <strlen>:

uint
strlen(char *s)
{
 3a0:	8b 4c 24 04          	mov    0x4(%esp),%ecx
  int n;

  for(n = 0; s[n]; n++)
 3a4:	31 c0                	xor    %eax,%eax
 3a6:	80 39 00             	cmpb   $0x0,(%ecx)
 3a9:	74 10                	je     3bb <strlen+0x1b>
 3ab:	31 d2                	xor    %edx,%edx
 3ad:	8d 76 00             	lea    0x0(%esi),%esi
 3b0:	83 c2 01             	add    $0x1,%edx
 3b3:	80 3c 11 00          	cmpb   $0x0,(%ecx,%edx,1)
 3b7:	89 d0                	mov    %edx,%eax
 3b9:	75 f5                	jne    3b0 <strlen+0x10>
    ;
  return n;
}
 3bb:	f3 c3                	repz ret 
 3bd:	8d 76 00             	lea    0x0(%esi),%esi

000003c0 <memset>:

void*
memset(void *dst, int c, uint n)
{
 3c0:	57                   	push   %edi
 3c1:	8b 54 24 08          	mov    0x8(%esp),%edx
}

static inline void
stosb(void *addr, int data, int cnt)
{
  asm volatile("cld; rep stosb" :
 3c5:	8b 4c 24 10          	mov    0x10(%esp),%ecx
 3c9:	8b 44 24 0c          	mov    0xc(%esp),%eax
 3cd:	89 d7                	mov    %edx,%edi
 3cf:	fc                   	cld    
 3d0:	f3 aa                	rep stos %al,%es:(%edi)
  stosb(dst, c, n);
  return dst;
}
 3d2:	89 d0                	mov    %edx,%eax
 3d4:	5f                   	pop    %edi
 3d5:	c3                   	ret    
 3d6:	8d 76 00             	lea    0x0(%esi),%esi
 3d9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

000003e0 <strchr>:

char*
strchr(const char *s, char c)
{
 3e0:	8b 44 24 04          	mov    0x4(%esp),%eax
 3e4:	0f b6 4c 24 08       	movzbl 0x8(%esp),%ecx
  for(; *s; s++)
 3e9:	0f b6 10             	movzbl (%eax),%edx
 3ec:	84 d2                	test   %dl,%dl
 3ee:	74 1d                	je     40d <strchr+0x2d>
    if(*s == c)
 3f0:	38 ca                	cmp    %cl,%dl
 3f2:	75 0e                	jne    402 <strchr+0x22>
 3f4:	eb 1c                	jmp    412 <strchr+0x32>
 3f6:	66 90                	xchg   %ax,%ax
}

char*
strchr(const char *s, char c)
{
  for(; *s; s++)
 3f8:	83 c0 01             	add    $0x1,%eax
    if(*s == c)
 3fb:	38 ca                	cmp    %cl,%dl
 3fd:	8d 76 00             	lea    0x0(%esi),%esi
 400:	74 0e                	je     410 <strchr+0x30>
}

char*
strchr(const char *s, char c)
{
  for(; *s; s++)
 402:	0f b6 50 01          	movzbl 0x1(%eax),%edx
 406:	84 d2                	test   %dl,%dl
 408:	75 ee                	jne    3f8 <strchr+0x18>
    if(*s == c)
      return (char*) s;
  return 0;
 40a:	31 c0                	xor    %eax,%eax
 40c:	c3                   	ret    
 40d:	31 c0                	xor    %eax,%eax
 40f:	90                   	nop
}
 410:	f3 c3                	repz ret 
 412:	f3 c3                	repz ret 
 414:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 41a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00000420 <gets>:

char*
gets(char *buf, int max)
{
 420:	55                   	push   %ebp
 421:	57                   	push   %edi
 422:	56                   	push   %esi
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 423:	31 f6                	xor    %esi,%esi
  return 0;
}

char*
gets(char *buf, int max)
{
 425:	53                   	push   %ebx
 426:	83 ec 2c             	sub    $0x2c,%esp
 429:	8b 7c 24 40          	mov    0x40(%esp),%edi
 42d:	8b 6c 24 44          	mov    0x44(%esp),%ebp
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 431:	eb 38                	jmp    46b <gets+0x4b>
 433:	90                   	nop
 434:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    cc = read(0, &c, 1);
 438:	8d 44 24 1f          	lea    0x1f(%esp),%eax
 43c:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 443:	00 
 444:	89 44 24 04          	mov    %eax,0x4(%esp)
 448:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 44f:	e8 48 01 00 00       	call   59c <read>
    if(cc < 1)
 454:	85 c0                	test   %eax,%eax
 456:	7e 1a                	jle    472 <gets+0x52>
      break;
    buf[i++] = c;
 458:	0f b6 44 24 1f       	movzbl 0x1f(%esp),%eax
gets(char *buf, int max)
{
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 45d:	89 de                	mov    %ebx,%esi
    cc = read(0, &c, 1);
    if(cc < 1)
      break;
    buf[i++] = c;
    if(c == '\n' || c == '\r')
 45f:	3c 0d                	cmp    $0xd,%al

  for(i=0; i+1 < max; ){
    cc = read(0, &c, 1);
    if(cc < 1)
      break;
    buf[i++] = c;
 461:	88 44 1f ff          	mov    %al,-0x1(%edi,%ebx,1)
    if(c == '\n' || c == '\r')
 465:	74 0b                	je     472 <gets+0x52>
 467:	3c 0a                	cmp    $0xa,%al
 469:	74 07                	je     472 <gets+0x52>
gets(char *buf, int max)
{
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 46b:	8d 5e 01             	lea    0x1(%esi),%ebx
 46e:	39 eb                	cmp    %ebp,%ebx
 470:	7c c6                	jl     438 <gets+0x18>
      break;
    buf[i++] = c;
    if(c == '\n' || c == '\r')
      break;
  }
  buf[i] = '\0';
 472:	c6 04 37 00          	movb   $0x0,(%edi,%esi,1)
  return buf;
}
 476:	83 c4 2c             	add    $0x2c,%esp
 479:	89 f8                	mov    %edi,%eax
 47b:	5b                   	pop    %ebx
 47c:	5e                   	pop    %esi
 47d:	5f                   	pop    %edi
 47e:	5d                   	pop    %ebp
 47f:	c3                   	ret    

00000480 <stat>:

int
stat(char *n, struct statt *st)
{
 480:	83 ec 1c             	sub    $0x1c,%esp
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 483:	8b 44 24 20          	mov    0x20(%esp),%eax
  return buf;
}

int
stat(char *n, struct statt *st)
{
 487:	89 5c 24 14          	mov    %ebx,0x14(%esp)
 48b:	89 74 24 18          	mov    %esi,0x18(%esp)
  int fd;
  int r;

  fd = open(n, O_RDONLY);
  if(fd < 0)
    return -1;
 48f:	be ff ff ff ff       	mov    $0xffffffff,%esi
stat(char *n, struct statt *st)
{
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 494:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
 49b:	00 
 49c:	89 04 24             	mov    %eax,(%esp)
 49f:	e8 20 01 00 00       	call   5c4 <open>
  if(fd < 0)
 4a4:	85 c0                	test   %eax,%eax
stat(char *n, struct statt *st)
{
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 4a6:	89 c3                	mov    %eax,%ebx
  if(fd < 0)
 4a8:	78 1a                	js     4c4 <stat+0x44>
    return -1;
  r = fstat(fd, st);
 4aa:	8b 44 24 24          	mov    0x24(%esp),%eax
 4ae:	89 1c 24             	mov    %ebx,(%esp)
 4b1:	89 44 24 04          	mov    %eax,0x4(%esp)
 4b5:	e8 22 01 00 00       	call   5dc <fstat>
  close(fd);
 4ba:	89 1c 24             	mov    %ebx,(%esp)
  int r;

  fd = open(n, O_RDONLY);
  if(fd < 0)
    return -1;
  r = fstat(fd, st);
 4bd:	89 c6                	mov    %eax,%esi
  close(fd);
 4bf:	e8 e8 00 00 00       	call   5ac <close>
  return r;
}
 4c4:	89 f0                	mov    %esi,%eax
 4c6:	8b 5c 24 14          	mov    0x14(%esp),%ebx
 4ca:	8b 74 24 18          	mov    0x18(%esp),%esi
 4ce:	83 c4 1c             	add    $0x1c,%esp
 4d1:	c3                   	ret    
 4d2:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 4d9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

000004e0 <atoi>:

int
atoi(const char *s)
{
 4e0:	53                   	push   %ebx
 4e1:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  int n;

  n = 0;
 4e5:	31 c0                	xor    %eax,%eax
  while('0' <= *s && *s <= '9')
 4e7:	0f b6 11             	movzbl (%ecx),%edx
 4ea:	8d 5a d0             	lea    -0x30(%edx),%ebx
 4ed:	80 fb 09             	cmp    $0x9,%bl
 4f0:	77 1e                	ja     510 <atoi+0x30>
 4f2:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    n = n*10 + *s++ - '0';
 4f8:	0f be d2             	movsbl %dl,%edx
 4fb:	83 c1 01             	add    $0x1,%ecx
 4fe:	8d 04 80             	lea    (%eax,%eax,4),%eax
 501:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
  int n;

  n = 0;
  while('0' <= *s && *s <= '9')
 505:	0f b6 11             	movzbl (%ecx),%edx
 508:	8d 5a d0             	lea    -0x30(%edx),%ebx
 50b:	80 fb 09             	cmp    $0x9,%bl
 50e:	76 e8                	jbe    4f8 <atoi+0x18>
    n = n*10 + *s++ - '0';
  return n;
}
 510:	5b                   	pop    %ebx
 511:	c3                   	ret    
 512:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 519:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000520 <memmove>:

void*
memmove(void *vdst, void *vsrc, int n)
{
 520:	56                   	push   %esi
 521:	53                   	push   %ebx
 522:	8b 5c 24 14          	mov    0x14(%esp),%ebx
 526:	8b 44 24 0c          	mov    0xc(%esp),%eax
 52a:	8b 74 24 10          	mov    0x10(%esp),%esi
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 52e:	85 db                	test   %ebx,%ebx
 530:	7e 14                	jle    546 <memmove+0x26>
    n = n*10 + *s++ - '0';
  return n;
}

void*
memmove(void *vdst, void *vsrc, int n)
 532:	31 d2                	xor    %edx,%edx
 534:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
    *dst++ = *src++;
 538:	0f b6 0c 16          	movzbl (%esi,%edx,1),%ecx
 53c:	88 0c 10             	mov    %cl,(%eax,%edx,1)
 53f:	83 c2 01             	add    $0x1,%edx
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 542:	39 da                	cmp    %ebx,%edx
 544:	75 f2                	jne    538 <memmove+0x18>
    *dst++ = *src++;
  return vdst;
}
 546:	5b                   	pop    %ebx
 547:	5e                   	pop    %esi
 548:	c3                   	ret    
 549:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00000550 <memcpy>:

void *
memcpy(void *dst, const void *src, uint n)
{
 550:	56                   	push   %esi
 551:	53                   	push   %ebx
 552:	8b 5c 24 14          	mov    0x14(%esp),%ebx
 556:	8b 44 24 0c          	mov    0xc(%esp),%eax
 55a:	8b 74 24 10          	mov    0x10(%esp),%esi
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 55e:	85 db                	test   %ebx,%ebx
 560:	7e 14                	jle    576 <memcpy+0x26>
 562:	31 d2                	xor    %edx,%edx
 564:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    *dst++ = *src++;
 568:	0f b6 0c 16          	movzbl (%esi,%edx,1),%ecx
 56c:	88 0c 10             	mov    %cl,(%eax,%edx,1)
 56f:	83 c2 01             	add    $0x1,%edx
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 572:	39 da                	cmp    %ebx,%edx
 574:	75 f2                	jne    568 <memcpy+0x18>

void *
memcpy(void *dst, const void *src, uint n)
{
  return memmove(dst, src, n);
}
 576:	5b                   	pop    %ebx
 577:	5e                   	pop    %esi
 578:	c3                   	ret    
 579:	90                   	nop
 57a:	90                   	nop
 57b:	90                   	nop

0000057c <fork>:
 57c:	b8 01 00 00 00       	mov    $0x1,%eax
 581:	cd 40                	int    $0x40
 583:	c3                   	ret    

00000584 <exit>:
 584:	b8 02 00 00 00       	mov    $0x2,%eax
 589:	cd 40                	int    $0x40
 58b:	c3                   	ret    

0000058c <wait>:
 58c:	b8 03 00 00 00       	mov    $0x3,%eax
 591:	cd 40                	int    $0x40
 593:	c3                   	ret    

00000594 <pipe>:
 594:	b8 04 00 00 00       	mov    $0x4,%eax
 599:	cd 40                	int    $0x40
 59b:	c3                   	ret    

0000059c <read>:
 59c:	b8 06 00 00 00       	mov    $0x6,%eax
 5a1:	cd 40                	int    $0x40
 5a3:	c3                   	ret    

000005a4 <write>:
 5a4:	b8 05 00 00 00       	mov    $0x5,%eax
 5a9:	cd 40                	int    $0x40
 5ab:	c3                   	ret    

000005ac <close>:
 5ac:	b8 07 00 00 00       	mov    $0x7,%eax
 5b1:	cd 40                	int    $0x40
 5b3:	c3                   	ret    

000005b4 <kill>:
 5b4:	b8 08 00 00 00       	mov    $0x8,%eax
 5b9:	cd 40                	int    $0x40
 5bb:	c3                   	ret    

000005bc <exec>:
 5bc:	b8 09 00 00 00       	mov    $0x9,%eax
 5c1:	cd 40                	int    $0x40
 5c3:	c3                   	ret    

000005c4 <open>:
 5c4:	b8 0a 00 00 00       	mov    $0xa,%eax
 5c9:	cd 40                	int    $0x40
 5cb:	c3                   	ret    

000005cc <mknod>:
 5cc:	b8 0b 00 00 00       	mov    $0xb,%eax
 5d1:	cd 40                	int    $0x40
 5d3:	c3                   	ret    

000005d4 <unlink>:
 5d4:	b8 0c 00 00 00       	mov    $0xc,%eax
 5d9:	cd 40                	int    $0x40
 5db:	c3                   	ret    

000005dc <fstat>:
 5dc:	b8 0d 00 00 00       	mov    $0xd,%eax
 5e1:	cd 40                	int    $0x40
 5e3:	c3                   	ret    

000005e4 <link>:
 5e4:	b8 0e 00 00 00       	mov    $0xe,%eax
 5e9:	cd 40                	int    $0x40
 5eb:	c3                   	ret    

000005ec <mkdir>:
 5ec:	b8 0f 00 00 00       	mov    $0xf,%eax
 5f1:	cd 40                	int    $0x40
 5f3:	c3                   	ret    

000005f4 <chdir>:
 5f4:	b8 10 00 00 00       	mov    $0x10,%eax
 5f9:	cd 40                	int    $0x40
 5fb:	c3                   	ret    

000005fc <dup>:
 5fc:	b8 11 00 00 00       	mov    $0x11,%eax
 601:	cd 40                	int    $0x40
 603:	c3                   	ret    

00000604 <getpid>:
 604:	b8 12 00 00 00       	mov    $0x12,%eax
 609:	cd 40                	int    $0x40
 60b:	c3                   	ret    

0000060c <sbrk>:
 60c:	b8 13 00 00 00       	mov    $0x13,%eax
 611:	cd 40                	int    $0x40
 613:	c3                   	ret    

00000614 <sleep>:
 614:	b8 14 00 00 00       	mov    $0x14,%eax
 619:	cd 40                	int    $0x40
 61b:	c3                   	ret    
 61c:	90                   	nop
 61d:	90                   	nop
 61e:	90                   	nop
 61f:	90                   	nop

00000620 <putc>:
#include "stat.h"
#include "user.h"

static void
putc(int fd, char c)
{
 620:	83 ec 2c             	sub    $0x2c,%esp
 623:	88 54 24 1c          	mov    %dl,0x1c(%esp)
  write(fd, &c, 1);
 627:	8d 54 24 1c          	lea    0x1c(%esp),%edx
 62b:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 632:	00 
 633:	89 54 24 04          	mov    %edx,0x4(%esp)
 637:	89 04 24             	mov    %eax,(%esp)
 63a:	e8 65 ff ff ff       	call   5a4 <write>
}
 63f:	83 c4 2c             	add    $0x2c,%esp
 642:	c3                   	ret    
 643:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 649:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000650 <printint>:

static void
printint(int fd, int xx, int base, int sgn)
{
 650:	57                   	push   %edi
 651:	56                   	push   %esi
 652:	53                   	push   %ebx
 653:	89 c3                	mov    %eax,%ebx
 655:	83 ec 10             	sub    $0x10,%esp
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
  if(sgn && xx < 0){
 658:	8b 44 24 20          	mov    0x20(%esp),%eax
 65c:	85 c0                	test   %eax,%eax
 65e:	74 60                	je     6c0 <printint+0x70>
 660:	89 d0                	mov    %edx,%eax
 662:	c1 e8 1f             	shr    $0x1f,%eax
 665:	84 c0                	test   %al,%al
 667:	74 57                	je     6c0 <printint+0x70>
    neg = 1;
    x = -xx;
 669:	89 d0                	mov    %edx,%eax
  int i, neg;
  uint x;

  neg = 0;
  if(sgn && xx < 0){
    neg = 1;
 66b:	bf 01 00 00 00       	mov    $0x1,%edi
    x = -xx;
 670:	f7 d8                	neg    %eax
  } else {
    x = xx;
  }

  i = 0;
 672:	31 f6                	xor    %esi,%esi
 674:	eb 04                	jmp    67a <printint+0x2a>
 676:	66 90                	xchg   %ax,%ax
  do{
    buf[i++] = digits[x % base];
 678:	89 d6                	mov    %edx,%esi
 67a:	31 d2                	xor    %edx,%edx
 67c:	f7 f1                	div    %ecx
 67e:	0f b6 92 d5 09 00 00 	movzbl 0x9d5(%edx),%edx
  }while((x /= base) != 0);
 685:	85 c0                	test   %eax,%eax
    x = xx;
  }

  i = 0;
  do{
    buf[i++] = digits[x % base];
 687:	88 14 34             	mov    %dl,(%esp,%esi,1)
 68a:	8d 56 01             	lea    0x1(%esi),%edx
  }while((x /= base) != 0);
 68d:	75 e9                	jne    678 <printint+0x28>
  if(neg)
 68f:	85 ff                	test   %edi,%edi
 691:	74 07                	je     69a <printint+0x4a>
    buf[i++] = '-';
 693:	c6 04 14 2d          	movb   $0x2d,(%esp,%edx,1)
 697:	8d 56 02             	lea    0x2(%esi),%edx

  while(--i >= 0)
 69a:	8d 72 ff             	lea    -0x1(%edx),%esi
 69d:	8d 76 00             	lea    0x0(%esi),%esi
    putc(fd, buf[i]);
 6a0:	0f be 14 34          	movsbl (%esp,%esi,1),%edx
 6a4:	89 d8                	mov    %ebx,%eax
    buf[i++] = digits[x % base];
  }while((x /= base) != 0);
  if(neg)
    buf[i++] = '-';

  while(--i >= 0)
 6a6:	83 ee 01             	sub    $0x1,%esi
    putc(fd, buf[i]);
 6a9:	e8 72 ff ff ff       	call   620 <putc>
    buf[i++] = digits[x % base];
  }while((x /= base) != 0);
  if(neg)
    buf[i++] = '-';

  while(--i >= 0)
 6ae:	83 fe ff             	cmp    $0xffffffff,%esi
 6b1:	75 ed                	jne    6a0 <printint+0x50>
    putc(fd, buf[i]);
}
 6b3:	83 c4 10             	add    $0x10,%esp
 6b6:	5b                   	pop    %ebx
 6b7:	5e                   	pop    %esi
 6b8:	5f                   	pop    %edi
 6b9:	c3                   	ret    
 6ba:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  neg = 0;
  if(sgn && xx < 0){
    neg = 1;
    x = -xx;
  } else {
    x = xx;
 6c0:	89 d0                	mov    %edx,%eax
  static char digits[] = "0123456789ABCDEF";
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
 6c2:	31 ff                	xor    %edi,%edi
 6c4:	eb ac                	jmp    672 <printint+0x22>
 6c6:	8d 76 00             	lea    0x0(%esi),%esi
 6c9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

000006d0 <printf>:
}

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
 6d0:	55                   	push   %ebp
 6d1:	57                   	push   %edi
 6d2:	56                   	push   %esi
 6d3:	53                   	push   %ebx
 6d4:	83 ec 2c             	sub    $0x2c,%esp
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 6d7:	8b 5c 24 44          	mov    0x44(%esp),%ebx
}

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
 6db:	8b 6c 24 40          	mov    0x40(%esp),%ebp
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 6df:	0f b6 0b             	movzbl (%ebx),%ecx
 6e2:	84 c9                	test   %cl,%cl
 6e4:	0f 84 86 00 00 00    	je     770 <printf+0xa0>
  char *s;
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
 6ea:	8d 44 24 48          	lea    0x48(%esp),%eax
{
  char *s;
  int c, i, state;
  uint *ap;

  state = 0;
 6ee:	31 f6                	xor    %esi,%esi
  ap = (uint*)(void*)&fmt + 1;
 6f0:	89 44 24 1c          	mov    %eax,0x1c(%esp)
 6f4:	eb 1b                	jmp    711 <printf+0x41>
 6f6:	66 90                	xchg   %ax,%ax
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
 6f8:	83 f9 25             	cmp    $0x25,%ecx
 6fb:	74 7b                	je     778 <printf+0xa8>
        state = '%';
      } else {
        putc(fd, c);
 6fd:	0f be d1             	movsbl %cl,%edx
 700:	89 e8                	mov    %ebp,%eax
 702:	e8 19 ff ff ff       	call   620 <putc>
      } else if(c == '%'){
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
 707:	83 c3 01             	add    $0x1,%ebx
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 70a:	0f b6 0b             	movzbl (%ebx),%ecx
 70d:	84 c9                	test   %cl,%cl
 70f:	74 5f                	je     770 <printf+0xa0>
    c = fmt[i] & 0xff;
    if(state == 0){
 711:	85 f6                	test   %esi,%esi
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
 713:	0f b6 c9             	movzbl %cl,%ecx
    if(state == 0){
 716:	74 e0                	je     6f8 <printf+0x28>
      if(c == '%'){
        state = '%';
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
 718:	83 fe 25             	cmp    $0x25,%esi
 71b:	75 ea                	jne    707 <printf+0x37>
      if(c == 'd'){
 71d:	83 f9 64             	cmp    $0x64,%ecx
 720:	0f 84 ba 00 00 00    	je     7e0 <printf+0x110>
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
 726:	83 f9 70             	cmp    $0x70,%ecx
 729:	74 55                	je     780 <printf+0xb0>
 72b:	83 f9 78             	cmp    $0x78,%ecx
 72e:	66 90                	xchg   %ax,%ax
 730:	74 4e                	je     780 <printf+0xb0>
        printint(fd, *ap, 16, 0);
        ap++;
      } else if(c == 's'){
 732:	83 f9 73             	cmp    $0x73,%ecx
 735:	74 71                	je     7a8 <printf+0xd8>
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
 737:	83 f9 63             	cmp    $0x63,%ecx
 73a:	0f 84 c3 00 00 00    	je     803 <printf+0x133>
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
 740:	83 f9 25             	cmp    $0x25,%ecx
        putc(fd, c);
 743:	ba 25 00 00 00       	mov    $0x25,%edx
 748:	89 e8                	mov    %ebp,%eax
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
 74a:	74 12                	je     75e <printf+0x8e>
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
 74c:	89 4c 24 18          	mov    %ecx,0x18(%esp)
 750:	e8 cb fe ff ff       	call   620 <putc>
        putc(fd, c);
 755:	8b 4c 24 18          	mov    0x18(%esp),%ecx
 759:	89 e8                	mov    %ebp,%eax
 75b:	0f be d1             	movsbl %cl,%edx
 75e:	e8 bd fe ff ff       	call   620 <putc>
      }
      state = 0;
 763:	31 f6                	xor    %esi,%esi
      } else if(c == '%'){
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
 765:	83 c3 01             	add    $0x1,%ebx
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 768:	0f b6 0b             	movzbl (%ebx),%ecx
 76b:	84 c9                	test   %cl,%cl
 76d:	75 a2                	jne    711 <printf+0x41>
 76f:	90                   	nop
        putc(fd, c);
      }
      state = 0;
    }
  }
}
 770:	83 c4 2c             	add    $0x2c,%esp
 773:	5b                   	pop    %ebx
 774:	5e                   	pop    %esi
 775:	5f                   	pop    %edi
 776:	5d                   	pop    %ebp
 777:	c3                   	ret    
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
        state = '%';
 778:	be 25 00 00 00       	mov    $0x25,%esi
 77d:	eb 88                	jmp    707 <printf+0x37>
 77f:	90                   	nop
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
        printint(fd, *ap, 16, 0);
 780:	8b 44 24 1c          	mov    0x1c(%esp),%eax
 784:	b9 10 00 00 00       	mov    $0x10,%ecx
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 789:	31 f6                	xor    %esi,%esi
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
        printint(fd, *ap, 16, 0);
 78b:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 792:	8b 10                	mov    (%eax),%edx
 794:	89 e8                	mov    %ebp,%eax
 796:	e8 b5 fe ff ff       	call   650 <printint>
        ap++;
 79b:	83 44 24 1c 04       	addl   $0x4,0x1c(%esp)
 7a0:	e9 62 ff ff ff       	jmp    707 <printf+0x37>
 7a5:	8d 76 00             	lea    0x0(%esi),%esi
      } else if(c == 's'){
        s = (char*)*ap;
 7a8:	8b 44 24 1c          	mov    0x1c(%esp),%eax
 7ac:	8b 38                	mov    (%eax),%edi
        ap++;
 7ae:	83 c0 04             	add    $0x4,%eax
 7b1:	89 44 24 1c          	mov    %eax,0x1c(%esp)
        if(s == 0)
 7b5:	85 ff                	test   %edi,%edi
 7b7:	74 64                	je     81d <printf+0x14d>
          s = "(null)";
        while(*s != 0){
 7b9:	0f b6 17             	movzbl (%edi),%edx
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 7bc:	31 f6                	xor    %esi,%esi
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
 7be:	84 d2                	test   %dl,%dl
 7c0:	0f 84 41 ff ff ff    	je     707 <printf+0x37>
 7c6:	66 90                	xchg   %ax,%ax
          putc(fd, *s);
 7c8:	0f be d2             	movsbl %dl,%edx
          s++;
 7cb:	83 c7 01             	add    $0x1,%edi
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
 7ce:	89 e8                	mov    %ebp,%eax
 7d0:	e8 4b fe ff ff       	call   620 <putc>
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
 7d5:	0f b6 17             	movzbl (%edi),%edx
 7d8:	84 d2                	test   %dl,%dl
 7da:	75 ec                	jne    7c8 <printf+0xf8>
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 7dc:	31 f6                	xor    %esi,%esi
 7de:	eb 85                	jmp    765 <printf+0x95>
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
 7e0:	8b 44 24 1c          	mov    0x1c(%esp),%eax
 7e4:	b1 0a                	mov    $0xa,%cl
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 7e6:	66 31 f6             	xor    %si,%si
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
 7e9:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 7f0:	8b 10                	mov    (%eax),%edx
 7f2:	89 e8                	mov    %ebp,%eax
 7f4:	e8 57 fe ff ff       	call   650 <printint>
        ap++;
 7f9:	83 44 24 1c 04       	addl   $0x4,0x1c(%esp)
 7fe:	e9 04 ff ff ff       	jmp    707 <printf+0x37>
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
 803:	8b 44 24 1c          	mov    0x1c(%esp),%eax
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 807:	31 f6                	xor    %esi,%esi
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
 809:	0f be 10             	movsbl (%eax),%edx
 80c:	89 e8                	mov    %ebp,%eax
 80e:	e8 0d fe ff ff       	call   620 <putc>
        ap++;
 813:	83 44 24 1c 04       	addl   $0x4,0x1c(%esp)
 818:	e9 ea fe ff ff       	jmp    707 <printf+0x37>
        ap++;
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
 81d:	bf ce 09 00 00       	mov    $0x9ce,%edi
 822:	eb 95                	jmp    7b9 <printf+0xe9>
 824:	90                   	nop
 825:	90                   	nop
 826:	90                   	nop
 827:	90                   	nop
 828:	90                   	nop
 829:	90                   	nop
 82a:	90                   	nop
 82b:	90                   	nop
 82c:	90                   	nop
 82d:	90                   	nop
 82e:	90                   	nop
 82f:	90                   	nop

00000830 <free>:
static Header base;
static Header *freep;

void
free(void *ap)
{
 830:	57                   	push   %edi
  Header *bp, *p;

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 831:	a1 a0 0d 00 00       	mov    0xda0,%eax
static Header base;
static Header *freep;

void
free(void *ap)
{
 836:	56                   	push   %esi
 837:	53                   	push   %ebx
 838:	8b 5c 24 10          	mov    0x10(%esp),%ebx
  Header *bp, *p;

  bp = (Header*) ap - 1;
 83c:	8d 4b f8             	lea    -0x8(%ebx),%ecx
 83f:	90                   	nop
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 840:	39 c8                	cmp    %ecx,%eax
 842:	8b 10                	mov    (%eax),%edx
 844:	73 04                	jae    84a <free+0x1a>
 846:	39 d1                	cmp    %edx,%ecx
 848:	72 16                	jb     860 <free+0x30>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
 84a:	39 d0                	cmp    %edx,%eax
 84c:	72 08                	jb     856 <free+0x26>
 84e:	39 c8                	cmp    %ecx,%eax
 850:	72 0e                	jb     860 <free+0x30>
 852:	39 d1                	cmp    %edx,%ecx
 854:	72 0a                	jb     860 <free+0x30>
static Header base;
static Header *freep;

void
free(void *ap)
{
 856:	89 d0                	mov    %edx,%eax
 858:	eb e6                	jmp    840 <free+0x10>
 85a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
      break;
  if(bp + bp->s.size == p->s.ptr){
 860:	8b 73 fc             	mov    -0x4(%ebx),%esi
 863:	8d 3c f1             	lea    (%ecx,%esi,8),%edi
 866:	39 d7                	cmp    %edx,%edi
 868:	74 18                	je     882 <free+0x52>
    bp->s.size += p->s.ptr->s.size;
    bp->s.ptr = p->s.ptr->s.ptr;
  } else
    bp->s.ptr = p->s.ptr;
 86a:	89 53 f8             	mov    %edx,-0x8(%ebx)
  if(p + p->s.size == bp){
 86d:	8b 50 04             	mov    0x4(%eax),%edx
 870:	8d 34 d0             	lea    (%eax,%edx,8),%esi
 873:	39 f1                	cmp    %esi,%ecx
 875:	74 22                	je     899 <free+0x69>
    p->s.size += bp->s.size;
    p->s.ptr = bp->s.ptr;
  } else
    p->s.ptr = bp;
 877:	89 08                	mov    %ecx,(%eax)
  freep = p;
 879:	a3 a0 0d 00 00       	mov    %eax,0xda0
}
 87e:	5b                   	pop    %ebx
 87f:	5e                   	pop    %esi
 880:	5f                   	pop    %edi
 881:	c3                   	ret    
  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
      break;
  if(bp + bp->s.size == p->s.ptr){
    bp->s.size += p->s.ptr->s.size;
 882:	03 72 04             	add    0x4(%edx),%esi
 885:	89 73 fc             	mov    %esi,-0x4(%ebx)
    bp->s.ptr = p->s.ptr->s.ptr;
 888:	8b 10                	mov    (%eax),%edx
 88a:	8b 12                	mov    (%edx),%edx
 88c:	89 53 f8             	mov    %edx,-0x8(%ebx)
  } else
    bp->s.ptr = p->s.ptr;
  if(p + p->s.size == bp){
 88f:	8b 50 04             	mov    0x4(%eax),%edx
 892:	8d 34 d0             	lea    (%eax,%edx,8),%esi
 895:	39 f1                	cmp    %esi,%ecx
 897:	75 de                	jne    877 <free+0x47>
    p->s.size += bp->s.size;
 899:	03 53 fc             	add    -0x4(%ebx),%edx
    p->s.ptr = bp->s.ptr;
  } else
    p->s.ptr = bp;
  freep = p;
 89c:	a3 a0 0d 00 00       	mov    %eax,0xda0
    bp->s.size += p->s.ptr->s.size;
    bp->s.ptr = p->s.ptr->s.ptr;
  } else
    bp->s.ptr = p->s.ptr;
  if(p + p->s.size == bp){
    p->s.size += bp->s.size;
 8a1:	89 50 04             	mov    %edx,0x4(%eax)
    p->s.ptr = bp->s.ptr;
 8a4:	8b 53 f8             	mov    -0x8(%ebx),%edx
 8a7:	89 10                	mov    %edx,(%eax)
  } else
    p->s.ptr = bp;
  freep = p;
}
 8a9:	5b                   	pop    %ebx
 8aa:	5e                   	pop    %esi
 8ab:	5f                   	pop    %edi
 8ac:	c3                   	ret    
 8ad:	8d 76 00             	lea    0x0(%esi),%esi

000008b0 <malloc>:
  return freep;
}

void*
malloc(uint nbytes)
{
 8b0:	57                   	push   %edi
 8b1:	56                   	push   %esi
 8b2:	53                   	push   %ebx
 8b3:	83 ec 10             	sub    $0x10,%esp
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
 8b6:	8b 15 a0 0d 00 00    	mov    0xda0,%edx
malloc(uint nbytes)
{
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
 8bc:	8b 5c 24 20          	mov    0x20(%esp),%ebx
 8c0:	83 c3 07             	add    $0x7,%ebx
 8c3:	c1 eb 03             	shr    $0x3,%ebx
 8c6:	83 c3 01             	add    $0x1,%ebx
  if((prevp = freep) == 0){
 8c9:	85 d2                	test   %edx,%edx
 8cb:	0f 84 9d 00 00 00    	je     96e <malloc+0xbe>
 8d1:	8b 02                	mov    (%edx),%eax
 8d3:	8b 48 04             	mov    0x4(%eax),%ecx
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
 8d6:	39 d9                	cmp    %ebx,%ecx
 8d8:	73 6e                	jae    948 <malloc+0x98>
        p->s.size -= nunits;
        p += p->s.size;
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
 8da:	8d 3c dd 00 00 00 00 	lea    0x0(,%ebx,8),%edi
 8e1:	eb 0e                	jmp    8f1 <malloc+0x41>
 8e3:	90                   	nop
 8e4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 8e8:	8b 02                	mov    (%edx),%eax
    if(p->s.size >= nunits){
 8ea:	8b 48 04             	mov    0x4(%eax),%ecx
 8ed:	39 cb                	cmp    %ecx,%ebx
 8ef:	76 57                	jbe    948 <malloc+0x98>
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
 8f1:	3b 05 a0 0d 00 00    	cmp    0xda0,%eax
 8f7:	89 c2                	mov    %eax,%edx
 8f9:	75 ed                	jne    8e8 <malloc+0x38>
morecore(uint nu)
{
  char *p;
  Header *hp;

  if(nu < PAGE)
 8fb:	81 fb ff 0f 00 00    	cmp    $0xfff,%ebx
 901:	b8 00 80 00 00       	mov    $0x8000,%eax
    nu = PAGE;
 906:	be 00 10 00 00       	mov    $0x1000,%esi
morecore(uint nu)
{
  char *p;
  Header *hp;

  if(nu < PAGE)
 90b:	76 04                	jbe    911 <malloc+0x61>
 90d:	89 f8                	mov    %edi,%eax
 90f:	89 de                	mov    %ebx,%esi
    nu = PAGE;
  p = sbrk(nu * sizeof(Header));
 911:	89 04 24             	mov    %eax,(%esp)
 914:	e8 f3 fc ff ff       	call   60c <sbrk>
  if(p == (char*) -1)
 919:	83 f8 ff             	cmp    $0xffffffff,%eax
 91c:	74 1a                	je     938 <malloc+0x88>
    return 0;
  hp = (Header*)p;
  hp->s.size = nu;
 91e:	89 70 04             	mov    %esi,0x4(%eax)
  free((void*)(hp + 1));
 921:	83 c0 08             	add    $0x8,%eax
 924:	89 04 24             	mov    %eax,(%esp)
 927:	e8 04 ff ff ff       	call   830 <free>
  return freep;
 92c:	8b 15 a0 0d 00 00    	mov    0xda0,%edx
      }
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
 932:	85 d2                	test   %edx,%edx
 934:	75 b2                	jne    8e8 <malloc+0x38>
 936:	66 90                	xchg   %ax,%ax
        return 0;
  }
}
 938:	83 c4 10             	add    $0x10,%esp
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
 93b:	31 c0                	xor    %eax,%eax
  }
}
 93d:	5b                   	pop    %ebx
 93e:	5e                   	pop    %esi
 93f:	5f                   	pop    %edi
 940:	c3                   	ret    
 941:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
      if(p->s.size == nunits)
 948:	39 cb                	cmp    %ecx,%ebx
 94a:	74 1c                	je     968 <malloc+0xb8>
        prevp->s.ptr = p->s.ptr;
      else {
        p->s.size -= nunits;
 94c:	29 d9                	sub    %ebx,%ecx
 94e:	89 48 04             	mov    %ecx,0x4(%eax)
        p += p->s.size;
 951:	8d 04 c8             	lea    (%eax,%ecx,8),%eax
        p->s.size = nunits;
 954:	89 58 04             	mov    %ebx,0x4(%eax)
      }
      freep = prevp;
 957:	89 15 a0 0d 00 00    	mov    %edx,0xda0
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
  }
}
 95d:	83 c4 10             	add    $0x10,%esp
        p->s.size -= nunits;
        p += p->s.size;
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
 960:	83 c0 08             	add    $0x8,%eax
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
  }
}
 963:	5b                   	pop    %ebx
 964:	5e                   	pop    %esi
 965:	5f                   	pop    %edi
 966:	c3                   	ret    
 967:	90                   	nop
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
      if(p->s.size == nunits)
        prevp->s.ptr = p->s.ptr;
 968:	8b 08                	mov    (%eax),%ecx
 96a:	89 0a                	mov    %ecx,(%edx)
 96c:	eb e9                	jmp    957 <malloc+0xa7>
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
 96e:	c7 05 a0 0d 00 00 a4 	movl   $0xda4,0xda0
 975:	0d 00 00 
    base.s.size = 0;
 978:	b8 a4 0d 00 00       	mov    $0xda4,%eax
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
 97d:	c7 05 a4 0d 00 00 a4 	movl   $0xda4,0xda4
 984:	0d 00 00 
    base.s.size = 0;
 987:	c7 05 a8 0d 00 00 00 	movl   $0x0,0xda8
 98e:	00 00 00 
 991:	e9 44 ff ff ff       	jmp    8da <malloc+0x2a>
